package yixin.utils.bazi.utils;

import lombok.Data;
import yixin.utils.bazi.BaZiMap;
import yixin.utils.bazi.maps.BaZiShenShaMap;
import yixin.utils.CommonUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 八字-神煞工具
 *
 * @author 善待
 */
@Data
public class BaZiShenShaUtil {

    /* 请求数据 */

    /**
     * 性别（男。女）
     */
    private String sex;
    /**
     * 季节
     */
    private String season;
    /**
     * 年干支纳音五行
     */
    private String yearGanZhiNaYinWuXing;

    /**
     * 年干
     */
    private String yearGan;
    /**
     * 月干
     */
    private String monthGan;
    /**
     * 日干
     */
    private String dayGan;
    /**
     * 时干
     */
    private String hourGan;
    /**
     * 大运干
     */
    private String daYunGan;
    /**
     * 流年干
     */
    private String liuNianGan;
    /**
     * 流月干
     */
    private String liuYueGan;
    /**
     * 流日干
     */
    private String liuRiGan;
    /**
     * 流时干
     */
    private String liuShiGan;

    /**
     * 年支
     */
    private String yearZhi;
    /**
     * 月支
     */
    private String monthZhi;
    /**
     * 日支
     */
    private String dayZhi;
    /**
     * 时支
     */
    private String hourZhi;
    /**
     * 大运支
     */
    private String daYunZhi;
    /**
     * 流年支
     */
    private String liuNianZhi;
    /**
     * 流月支
     */
    private String liuYueZhi;
    /**
     * 流日支
     */
    private String liuRiZhi;
    /**
     * 流时支
     */
    private String liuShiZhi;

    /**
     * 年干支
     */
    private String yearGanZhi;
    /**
     * 月干支
     */
    private String monthGanZhi;
    /**
     * 日干支
     */
    private String dayGanZhi;
    /**
     * 时干支
     */
    private String hourGanZhi;
    /**
     * 大运干支
     */
    private String daYunGanZhi;
    /**
     * 流年干支
     */
    private String liuNianGanZhi;
    /**
     * 流月干支
     */
    private String liuYueGanZhi;
    /**
     * 流日干支
     */
    private String liuRiGanZhi;
    /**
     * 流时干支
     */
    private String liuShiGanZhi;

    /* 响应数据 */

    /**
     * 年干支神煞
     */
    private List<String> yearGanZhiShenSha = new ArrayList<>();
    /**
     * 月干支神煞
     */
    private List<String> monthGanZhiShenSha = new ArrayList<>();
    /**
     * 日干支神煞
     */
    private List<String> dayGanZhiShenSha = new ArrayList<>();
    /**
     * 时干支神煞
     */
    private List<String> hourGanZhiShenSha = new ArrayList<>();
    /**
     * 大运神煞
     */
    private List<String> daYunShenSha = new ArrayList<>();
    /**
     * 流年神煞
     */
    private List<String> liuNianShenSha = new ArrayList<>();
    /**
     * 流月神煞
     */
    private List<String> liuYueShenSha = new ArrayList<>();
    /**
     * 流日神煞
     */
    private List<String> liuRiShenSha = new ArrayList<>();
    /**
     * 流时神煞
     */
    private List<String> liuShiShenSha = new ArrayList<>();

    /**
     * 小儿关煞
     */
    List<String> xiaoErGuanSha = new ArrayList<>();

//****************************************************************************************************************************************************

    /**
     * 初始化常用神煞
     *
     * @param sex             性别（男。女）
     * @param season          季节
     * @param yearGanZhiNaYin 年干支纳音
     * @param yearGanZhi      年干支
     * @param monthGanZhi     月干支
     * @param dayGanZhi       日干支
     * @param hourGanZhi      时干支
     * @param daYunGanZhi     大运干支\胎元干支
     * @param liuNianGanZhi   流年干支\胎息干支\小运干支
     * @param liuYueGanZhi    流月干支\命宫干支
     * @param liuRiGanZhi     流日干支\身宫干支
     * @param liuShiGanZhi    流时干支
     */
    public BaZiShenShaUtil(String sex, String season, String yearGanZhiNaYin, String yearGanZhi, String monthGanZhi, String dayGanZhi, String hourGanZhi, String daYunGanZhi, String liuNianGanZhi, String liuYueGanZhi, String liuRiGanZhi, String liuShiGanZhi) {

        // 设置数据
        this.sex = sex; // 性别
        this.season = season; // 季节
        this.yearGanZhiNaYinWuXing = yearGanZhiNaYin.substring(2, 3); // 年干支纳音五行
        this.yearGanZhi = (null != yearGanZhi && yearGanZhi.length() == 2) ? yearGanZhi : CommonUtil.EMPTY; // 年干支
        this.yearGan = getYearGanZhi().substring(0, 1); // 年干
        this.yearZhi = getYearGanZhi().substring(1, 2); // 年支
        this.monthGanZhi = (null != monthGanZhi && monthGanZhi.length() == 2) ? monthGanZhi : CommonUtil.EMPTY; // 月干支
        this.monthGan = getMonthGanZhi().substring(0, 1); // 月干
        this.monthZhi = getMonthGanZhi().substring(1, 2); // 月支
        this.dayGanZhi = (null != dayGanZhi && dayGanZhi.length() == 2) ? dayGanZhi : CommonUtil.EMPTY; // 日干支
        this.dayGan = getDayGanZhi().substring(0, 1); // 日干
        this.dayZhi = getDayGanZhi().substring(1, 2); // 日支
        this.hourGanZhi = (null != hourGanZhi && hourGanZhi.length() == 2) ? hourGanZhi : CommonUtil.EMPTY; // 时干支
        this.hourGan = getHourGanZhi().substring(0, 1); // 时干
        this.hourZhi = getHourGanZhi().substring(1, 2); // 时支
        this.daYunGanZhi = (null != daYunGanZhi && daYunGanZhi.length() == 2) ? daYunGanZhi : CommonUtil.EMPTY; // 大运干支\胎元干支
        this.daYunGan = getDaYunGanZhi().substring(0, 1); // 大运干\胎元干
        this.daYunZhi = getDaYunGanZhi().substring(1, 2); // 大运支\胎元支
        this.liuNianGanZhi = (null != liuNianGanZhi && liuNianGanZhi.length() == 2) ? liuNianGanZhi : CommonUtil.EMPTY; // 流年干支\胎息干支\小运干支
        this.liuNianGan = getLiuNianGanZhi().substring(0, 1); // 流年干\胎息干\小运干
        this.liuNianZhi = getLiuNianGanZhi().substring(1, 2); // 流年支\胎息支\小运支
        this.liuYueGanZhi = (null != liuYueGanZhi && liuYueGanZhi.length() == 2) ? liuYueGanZhi : CommonUtil.EMPTY; // 流月干支\命宫干支
        this.liuYueGan = getLiuYueGanZhi().substring(0, 1); // 流月干\命宫干
        this.liuYueZhi = getLiuYueGanZhi().substring(1, 2); // 流月支\命宫支
        this.liuRiGanZhi = (null != liuRiGanZhi && liuRiGanZhi.length() == 2) ? liuRiGanZhi : CommonUtil.EMPTY; // 流日干支\身宫干支
        this.liuRiGan = getLiuRiGanZhi().substring(0, 1); // 流日干\身宫干
        this.liuRiZhi = getLiuRiGanZhi().substring(1, 2); // 流日支\身宫支
        this.liuShiGanZhi = (null != liuShiGanZhi && liuShiGanZhi.length() == 2) ? liuShiGanZhi : CommonUtil.EMPTY; // 流时干支
        this.liuShiGan = getLiuShiGanZhi().substring(0, 1); // 流时干
        this.liuShiZhi = getLiuShiGanZhi().substring(1, 2); // 流时支

        // 计算数据
        shenSha(); // 计算神煞
        xiaoErGuanSha(); // 计算小儿关煞

    }

//====================================================================================================================================================

    /**
     * 计算神煞
     */
    public void shenSha() {

        // 1、计算数据
        addShenSha4(BaZiShenShaMap.TAI_JI_GUI_REN, getYearGan(), getDayGan()); // 太极贵人
        addShenSha4(BaZiShenShaMap.TIAN_YI_GUI_REN, getYearGan(), getDayGan()); // 天乙贵人
        addShenSha4(BaZiShenShaMap.FU_XING_GUI_REN, getYearGan(), getDayGan()); // 福星贵人
        addShenSha4(BaZiShenShaMap.WEN_CHANG_GUI_REN, getYearGan(), getDayGan()); // 文昌贵人
        addShenSha4(BaZiShenShaMap.TIAN_CHU_GUI_REN, getYearGan(), getDayGan()); // 天厨贵人
        addShenSha2(BaZiShenShaMap.YUE_DE_GUI_REN, getMonthZhi()); // 月德贵人
        addShenSha2(BaZiShenShaMap.DE_XIU_GUI_REN, getMonthZhi()); // 德秀贵人
        tianDeGuiRen(); // 天德贵人
        addShenSha4(BaZiShenShaMap.TIAN_GUAN_GUI_REN, getYearGan(), getDayGan()); // 天官贵人
        sanQiGuiRen(); // 三奇贵人
        liuJiaKongWang(); // 六甲空亡
        this.hourGanZhiShenSha.add(BaZiShenShaMap.JIE_LU_KONG_WANG.get(getDayGan() + getHourZhi())); // 截路空亡
        addShenSha3(BaZiShenShaMap.YIN_ZHU_YANG_SHOU, getMonthZhi()); // 阴注阳受
        tianLuoDiWang(); // 天罗地网
        addShenSha1(BaZiShenShaMap.SHI_E_DA_BAI, "十恶大败"); // 十恶大败
        addShenSha1(BaZiShenShaMap.YIN_CHA_YANG_CUO, "阴差阳错"); // 阴差阳错
        this.dayGanZhiShenSha.add(BaZiShenShaMap.SI_FEI_RI.get(getSeason() + getDayGanZhi())); // 四废日
        addShenSha1(BaZiShenShaMap.LIU_XIU_RI, "六秀日"); // 六秀日
        addShenSha1(BaZiShenShaMap.SHI_LING_RI, "十灵日"); // 十灵日
        addShenSha1(BaZiShenShaMap.KUI_GANG_RI, "魁罡日"); // 魁罡日
        addShenSha1(BaZiShenShaMap.BA_ZHUAN_RI, "八专日"); // 八专日
        addShenSha1(BaZiShenShaMap.JIU_CHOU_RI, "九丑日"); // 九丑日
        addShenSha1(BaZiShenShaMap.GU_LUAN_SHA, "孤鸾煞"); // 孤鸾煞
        addShenSha4(BaZiShenShaMap.HONG_YAN_SHA, "", getDayGan()); // 红艳煞
        addShenSha4(BaZiShenShaMap.GOU_JIAO_SHA, getYearZhi(), ""); // 勾绞煞
        tongZiSha(); // 童子煞
        chongTianSha(); // 冲天煞
        huaGai(); // 华盖
        addShenSha4(BaZiShenShaMap.GUO_YIN, getYearGan(), getDayGan()); // 国印
        jinShen(); // 金神
        addShenSha4(BaZiShenShaMap.JIN_YU, getYearGan(), getDayGan()); // 金舆
        gongLu(); // 拱禄
        addShenSha4(BaZiShenShaMap.LU_SHEN, "", getDayGan()); // 禄神
        addShenSha4(BaZiShenShaMap.JIANG_XING, getYearZhi(), getDayZhi()); // 将星
        addShenSha4(BaZiShenShaMap.TAO_HUA, getYearZhi(), getDayZhi()); // 桃花
        addShenSha4(BaZiShenShaMap.TIAN_XI, getYearZhi(), ""); // 天喜
        addShenSha4(BaZiShenShaMap.HONG_LUAN, getYearZhi(), ""); // 红鸾
        addShenSha4(BaZiShenShaMap.TIAN_YI, getMonthZhi(), ""); // 天医
        addShenSha4(BaZiShenShaMap.CI_GUAN_LU_MING, getYearGanZhiNaYinWuXing(), ""); // 词馆
        addShenSha4(BaZiShenShaMap.XUE_TANG_LU_MING, getYearGanZhiNaYinWuXing(), ""); // 学堂
        addShenSha3(BaZiShenShaMap.TIAN_SHE, getMonthZhi()); // 天赦
        addShenSha4(BaZiShenShaMap.YI_MA, getYearZhi(), getDayZhi()); // 驿马
        addShenSha4(BaZiShenShaMap.YANG_REN, "", getDayGan()); // 羊刃
        addShenSha4(BaZiShenShaMap.FEI_REN, "", getDayGan()); // 飞刃
        addShenSha4(BaZiShenShaMap.LIU_XIA, "", getDayGan()); // 流霞
        addShenSha4(BaZiShenShaMap.JIE_SHA, getYearZhi(), getDayZhi()); // 劫煞
        addShenSha4(BaZiShenShaMap.WANG_SHEN, getYearZhi(), getDayZhi()); // 亡神
        addShenSha4(BaZiShenShaMap.DIAO_KE, getYearZhi(), getDayZhi()); // 吊客
        addShenSha4(BaZiShenShaMap.PI_MA, getYearZhi(), getDayZhi()); // 披麻
        addShenSha4(BaZiShenShaMap.SANG_MEN, getYearZhi(), ""); // 丧门
        addShenSha4(BaZiShenShaMap.ZAI_SHA, getYearZhi(), ""); // 灾煞
        addShenSha4(BaZiShenShaMap.GU_CHEN, getYearZhi(), ""); // 孤辰
        addShenSha4(BaZiShenShaMap.SU_GUA, getYearZhi(), ""); // 寡宿
        yuanChen(); // 元辰
        addShenSha4(BaZiShenShaMap.XUE_REN, getMonthZhi(), ""); // 血刃
        addShenSha3(BaZiShenShaMap.TIAN_ZHUAN, getMonthZhi()); // 天转
        addShenSha3(BaZiShenShaMap.DI_ZHUAN, getMonthZhi()); // 地转
        addShenSha3(BaZiShenShaMap.LIU_E, getYearZhi()); // 六厄

        // 2、删除重复数据
        this.yearGanZhiShenSha = CommonUtil.removeDuplicates(getYearGanZhiShenSha()); // 年干支神煞
        this.monthGanZhiShenSha = CommonUtil.removeDuplicates(getMonthGanZhiShenSha()); // 月干支神煞
        this.dayGanZhiShenSha = CommonUtil.removeDuplicates(getDayGanZhiShenSha()); // 日干支神煞
        this.hourGanZhiShenSha = CommonUtil.removeDuplicates(getHourGanZhiShenSha()); // 时干支神煞
        this.daYunShenSha = CommonUtil.removeDuplicates(getDaYunShenSha()); // 大运神煞
        this.liuNianShenSha = CommonUtil.removeDuplicates(getLiuNianShenSha()); // 流年神煞
        this.liuYueShenSha = CommonUtil.removeDuplicates(getLiuYueShenSha()); // 流月神煞
        this.liuRiShenSha = CommonUtil.removeDuplicates(getLiuRiShenSha()); // 流日神煞
        this.liuShiShenSha = CommonUtil.removeDuplicates(getLiuShiShenSha()); // 流时神煞

    }

    /**
     * 计算小儿关煞
     */
    private void xiaoErGuanSha() {

        List<String> list = new ArrayList<>();

        // 1、[年支+月支]相关
        String yzmz = getYearZhi() + getMonthZhi(); // 年支+月支
        list.add(BaZiShenShaMap.JIE_SHA_GUAN.get(yzmz)); // 劫煞关
        list.add(BaZiShenShaMap.XIAN_CHI_GUAN.get(yzmz)); // 咸池关

        // 2、[年支+时支]相关
        String yzhz = getYearZhi() + getHourZhi(); // 年支+时支
        list.add(BaZiShenShaMap.TANG_HUO_GUAN.get(yzhz)); // 汤火关
        list.add(BaZiShenShaMap.DUAN_MING_GUAN.get(yzhz)); // 短命关
        list.add(BaZiShenShaMap.GUI_MEN_GUAN.get(yzhz)); // 鬼门关
        list.add(BaZiShenShaMap.ZHUANG_MING_GUAN.get(yzhz)); // 撞命关
        list.add(BaZiShenShaMap.MAI_ER_GUAN.get(yzhz)); // 埋儿关
        list.add(BaZiShenShaMap.WU_GUI_GUAN.get(yzhz)); // 五鬼关
        list.add(BaZiShenShaMap.TIAN_GOU_GUAN.get(yzhz)); // 天狗关
        list.add(BaZiShenShaMap.TIAN_DIAO_GUAN.get(yzhz)); // 天吊关
        list.add(BaZiShenShaMap.XIU_AN_GUAN.get(yzhz)); // 休庵关（和尚关）

        // 3、[月支+时支]相关
        String mzhz = getMonthZhi() + getHourZhi(); // 月支+时支
        list.add(BaZiShenShaMap.BAI_RI_GUAN.get(mzhz)); // 百日关
        list.add(BaZiShenShaMap.JIN_SUO_GUAN.get(mzhz)); // 金锁关
        list.add(BaZiShenShaMap.YE_TI_GUAN.get(mzhz)); // 夜啼关
        list.add(BaZiShenShaMap.YU_PEN_GUAN.get(mzhz)); // 浴盆关
        list.add(BaZiShenShaMap.SI_ZHU_GUAN.get(mzhz)); // 四柱关
        list.add(BaZiShenShaMap.SI_JI_GUAN.get(mzhz)); // 四季关
        list.add(BaZiShenShaMap.YAN_WANG_GUAN.get(mzhz)); // 阎王关
        list.add(BaZiShenShaMap.SHUI_HUO_GUAN.get(mzhz)); // 水火关
        list.add(BaZiShenShaMap.SHEN_SHUI_GUAN.get(mzhz)); // 深水关
        list.add(BaZiShenShaMap.WU_QING_GUAN.get(mzhz)); // 无情关
        list.add(BaZiShenShaMap.JI_JIAO_GUAN.get(mzhz)); // 急脚关
        list.add(BaZiShenShaMap.DUAN_QIAO_GUAN.get(mzhz)); // 断桥关
        list.add(BaZiShenShaMap.ZHI_NAN_GUAN.get(mzhz)); // 直难关
        list.add(BaZiShenShaMap.XUE_REN_GUAN.get(mzhz)); // 血刃关
        list.add(BaZiShenShaMap.JI_BAI_GUAN.get(mzhz)); // 基败关
        list.add(BaZiShenShaMap.SHUI_XUE_GUAN.get(mzhz)); // 水穴关
        list.add(BaZiShenShaMap.JIANG_JUN_JIAN.get(mzhz)); // 将军箭
        list.add(BaZiShenShaMap.JIANG_JUN_JIAN.get(mzhz)); // 将军箭
        list.add(BaZiShenShaMap.BAI_HU_GUAN_MONTH_ZHI.get(mzhz)); // 白虎关

        // 4.1、[年干+时支]相关
        String yghz = getYearGan() + getHourZhi(); // 日干+时支
        list.add(BaZiShenShaMap.TIE_SHE_GUAN_YEAR.get(yghz)); // 铁蛇关
        list.add(BaZiShenShaMap.JI_FEI_GUAN.get(yghz)); // 鸡飞关
        list.add(BaZiShenShaMap.LUO_JING_GUAN.get(yghz)); // 落井关
        list.add(BaZiShenShaMap.LEI_GONG_GUAN.get(yghz)); // 雷公关
        list.add(BaZiShenShaMap.QIAN_RI_GUAN.get(yghz)); // 千日关
        list.add(BaZiShenShaMap.DUAN_CHANG_GUAN.get(yghz)); // 断肠关
        list.add(BaZiShenShaMap.QU_MING_GUAN.get(yghz)); // 取命关
        // 4.2、[日干+时支]相关
        String dghz = getDayGan() + getHourZhi(); // 日干+时支
        list.add(BaZiShenShaMap.BAI_HU_GUAN_DAY_GAN.get(dghz)); // 白虎关
        list.add(BaZiShenShaMap.TIE_SHE_GUAN_DAY.get(dghz)); // 铁蛇关
        list.add(BaZiShenShaMap.JI_FEI_GUAN.get(dghz)); // 鸡飞关
        list.add(BaZiShenShaMap.LUO_JING_GUAN.get(dghz)); // 落井关
        list.add(BaZiShenShaMap.LEI_GONG_GUAN.get(dghz)); // 雷公关
        list.add(BaZiShenShaMap.QIAN_RI_GUAN.get(dghz)); // 千日关
        list.add(BaZiShenShaMap.DUAN_CHANG_GUAN.get(dghz)); // 断肠关
        list.add(BaZiShenShaMap.QU_MING_GUAN.get(dghz)); // 取命关

        // 5、其他相关
        list.add(BaZiShenShaMap.DUO_E_GUAN.get(getYearGanZhiNaYinWuXing() + getMonthZhi() + getSex())); // 多厄关

        // 6、设置数据
        this.xiaoErGuanSha = CommonUtil.removeDuplicates(list);

    }

//----------------------------------------------------------------------------------------------------------------------------------------------------

    /**
     * 计算元辰
     */
    private void yuanChen() {

        String yearGanYinYang = BaZiMap.TIAN_GAN_YIN_YANG.get(getYearGan()); // 天干阴阳（天干为键）
        Map<String, String> yuanChenYangNan = BaZiShenShaMap.YUAN_CHEN_YANG_NAN; // 元辰（年支+其余地支），阳男阴女
        Map<String, String> yuanChenYinNan = BaZiShenShaMap.YUAN_CHEN_YIN_NAN; // 元辰（年支+其余地支），阴男阳女

        Map<String, String> map = new HashMap<>();

        String sexYinYang = yearGanYinYang + getSex();
        if ("阳男".equals(sexYinYang) || "阴女".equals(sexYinYang)) {
            map = yuanChenYangNan; // 阳男阴女
        } else if ("阴男".equals(sexYinYang) || "阳女".equals(sexYinYang)) {
            map = yuanChenYinNan;  // 阴男阳女
        }

        addShenSha4(map, getYearZhi(), "");

    }

    /**
     * 计算天德贵人
     */
    private void tianDeGuiRen() {

        Map<String, String> tianDeGuiRenMap = BaZiShenShaMap.TIAN_DE_GUI_REN; // 天德贵人（月支+四柱天干\其余地支为键）

        // 计算四柱神煞
        this.yearGanZhiShenSha.add(tianDeGuiRenMap.get(getMonthZhi() + getYearGan()));
        this.monthGanZhiShenSha.add(tianDeGuiRenMap.get(getMonthZhi() + getMonthGan()));
        this.dayGanZhiShenSha.add(tianDeGuiRenMap.get(getMonthZhi() + getDayGan()));
        this.hourGanZhiShenSha.add(tianDeGuiRenMap.get(getMonthZhi() + getHourGan()));
        this.yearGanZhiShenSha.add(tianDeGuiRenMap.get(getMonthZhi() + getYearZhi()));
        this.monthGanZhiShenSha.add(tianDeGuiRenMap.get(getMonthZhi() + getMonthZhi()));
        this.dayGanZhiShenSha.add(tianDeGuiRenMap.get(getMonthZhi() + getDayZhi()));
        this.hourGanZhiShenSha.add(tianDeGuiRenMap.get(getMonthZhi() + getHourZhi()));

    }

    /**
     * 计算拱禄
     */
    private void gongLu() {

        Map<String, String> gongLuMap = BaZiShenShaMap.GONG_LU; // 拱禄（日干支+时干支+其余地支为键）

        // 计算四柱神煞
        this.yearGanZhiShenSha.add(gongLuMap.get(getDayGanZhi() + getHourGanZhi() + getYearZhi()));
        this.monthGanZhiShenSha.add(gongLuMap.get(getDayGanZhi() + getHourGanZhi() + getMonthZhi()));
        this.dayGanZhiShenSha.add(gongLuMap.get(getDayGanZhi() + getHourGanZhi() + getDayZhi()));
        this.hourGanZhiShenSha.add(gongLuMap.get(getDayGanZhi() + getHourGanZhi() + getHourZhi()));

    }

    /**
     * 计算华盖
     */
    private void huaGai() {

        Map<String, String> huaGaiMap = BaZiShenShaMap.HUA_GAI; // 华盖（年支\日支+其余地支为键）

        // 计算四柱神煞
//        this.yearGanZhiShenSha.add(huaGaiMap.get(getYearZhi() + getYearZhi()));
        this.yearGanZhiShenSha.add(huaGaiMap.get(getDayZhi() + getYearZhi()));
        this.monthGanZhiShenSha.add(huaGaiMap.get(getYearZhi() + getMonthZhi()));
        this.monthGanZhiShenSha.add(huaGaiMap.get(getDayZhi() + getMonthZhi()));
        this.dayGanZhiShenSha.add(huaGaiMap.get(getYearZhi() + getDayZhi()));
//        this.dayGanZhiShenSha.add(huaGaiMap.get(getDayZhi() + getDayZhi()));
        this.hourGanZhiShenSha.add(huaGaiMap.get(getYearZhi() + getHourZhi()));
        this.hourGanZhiShenSha.add(huaGaiMap.get(getDayZhi() + getHourZhi()));

    }

    /**
     * 计算童子煞
     */
    private void tongZiSha() {

        Map<String, String> tongZiShaMap = BaZiShenShaMap.TONG_ZI_SHA; // 童子煞（季节+日支\时支为键。年柱纳音五行+日支\时支为键）

        // 计算日柱、时柱神煞
        this.dayGanZhiShenSha.add(tongZiShaMap.get(getSeason() + getDayZhi()));
        this.hourGanZhiShenSha.add(tongZiShaMap.get(getSeason() + getHourZhi()));
        this.dayGanZhiShenSha.add(tongZiShaMap.get(getYearGanZhiNaYinWuXing() + getDayZhi()));
        this.hourGanZhiShenSha.add(tongZiShaMap.get(getYearGanZhiNaYinWuXing() + getHourZhi()));

    }

    /**
     * 计算三奇贵人
     */
    private void sanQiGuiRen() {

        if ("甲戊庚".equals(getYearGan() + getMonthGan() + getDayGan()) || "乙丙丁".equals(getYearGan() + getMonthGan() + getDayGan()) || "壬癸辛".equals(getYearGan() + getMonthGan() + getDayGan())) {
            this.yearGanZhiShenSha.add("三奇贵人");
            this.monthGanZhiShenSha.add("三奇贵人");
            this.dayGanZhiShenSha.add("三奇贵人");
        } else if ("甲戊庚".equals(getMonthGan() + getDayGan() + getHourGan()) || "乙丙丁".equals(getMonthGan() + getDayGan() + getHourGan()) || "壬癸辛".equals(getMonthGan() + getDayGan() + getHourGan())) {
            this.monthGanZhiShenSha.add("三奇贵人");
            this.dayGanZhiShenSha.add("三奇贵人");
            this.hourGanZhiShenSha.add("三奇贵人");
        }

    }

    /**
     * 计算六甲空亡
     */
    private void liuJiaKongWang() {

        Map<String, String> liuJiaKongWangMap = BaZiShenShaMap.LIU_JIA_KONG_WANG; // 六甲空亡（年干支\日干支+四柱地支为键）

        // 计算四柱神煞
        this.yearGanZhiShenSha.add(liuJiaKongWangMap.get(getYearGanZhi() + getYearZhi()));
        this.yearGanZhiShenSha.add(liuJiaKongWangMap.get(getDayGanZhi() + getYearZhi()));
        this.monthGanZhiShenSha.add(liuJiaKongWangMap.get(getYearGanZhi() + getMonthZhi()));
        this.monthGanZhiShenSha.add(liuJiaKongWangMap.get(getDayGanZhi() + getMonthZhi()));
        this.dayGanZhiShenSha.add(liuJiaKongWangMap.get(getYearGanZhi() + getDayZhi()));
        this.dayGanZhiShenSha.add(liuJiaKongWangMap.get(getDayGanZhi() + getDayZhi()));
        this.hourGanZhiShenSha.add(liuJiaKongWangMap.get(getYearGanZhi() + getHourZhi()));
        this.hourGanZhiShenSha.add(liuJiaKongWangMap.get(getDayGanZhi() + getHourZhi()));

    }

    /**
     * 计算天罗地网
     */
    private void tianLuoDiWang() {

        Map<String, String> tianLuoDiWangMap = BaZiShenShaMap.TIAN_LUO_DI_WANG; // 天罗地网（年支\日支+其余三支为键）

        // 计算四柱神煞
        this.yearGanZhiShenSha.add(tianLuoDiWangMap.get(getYearZhi() + getMonthZhi()));
        this.yearGanZhiShenSha.add(tianLuoDiWangMap.get(getYearZhi() + getDayZhi()));
        this.yearGanZhiShenSha.add(tianLuoDiWangMap.get(getYearZhi() + getHourZhi()));
        this.yearGanZhiShenSha.add(tianLuoDiWangMap.get(getMonthZhi() + getYearZhi()));
//        this.yearGanZhiShenSha.add(tianLuoDiWangMap.get(getDayZhi()) + getYearZhi());
//        this.yearGanZhiShenSha.add(tianLuoDiWangMap.get(getHourZhi()) + getYearZhi());
        this.monthGanZhiShenSha.add(tianLuoDiWangMap.get(getMonthZhi() + getDayZhi()));
        this.monthGanZhiShenSha.add(tianLuoDiWangMap.get(getDayZhi() + getMonthZhi()));
        this.dayGanZhiShenSha.add(tianLuoDiWangMap.get(getDayZhi() + getHourZhi()));
        this.dayGanZhiShenSha.add(tianLuoDiWangMap.get(getHourZhi() + getDayZhi()));
        this.hourGanZhiShenSha.add(tianLuoDiWangMap.get(getHourZhi() + getMonthZhi()));
        this.hourGanZhiShenSha.add(tianLuoDiWangMap.get(getMonthZhi() + getHourZhi()));
        this.hourGanZhiShenSha.add(tianLuoDiWangMap.get(getDayZhi() + getHourZhi()));

    }

    /**
     * 计算冲天煞
     */
    private void chongTianSha() {

        // 1.1、判断年干支与月干支是否相同
        if (getYearGanZhi().equals(getMonthGanZhi())) {
            this.yearGanZhiShenSha.add("冲天煞");
            this.monthGanZhiShenSha.add("冲天煞");

        }
        // 1.2、判断日干支与时干支是否相同
        if (getDayGanZhi().equals(getHourGanZhi())) {
            this.dayGanZhiShenSha.add("冲天煞");
            this.hourGanZhiShenSha.add("冲天煞");
        }

    }

    /**
     * 计算金神
     */
    private void jinShen() {

        // 1.1、判断日支，若匹配则添加日柱神煞
        for (String key : BaZiShenShaMap.JIN_SHEN) {
            if (getDayGanZhi().equals(key)) this.dayGanZhiShenSha.add("金神");
        }
        // 1.2、判断时支，若匹配则添加时柱神煞
        for (String key : BaZiShenShaMap.JIN_SHEN) {
            if (getHourGanZhi().equals(key)) this.hourGanZhiShenSha.add("金神");
        }

    }

//----------------------------------------------------------------------------------------------------------------------------------------------------

    /**
     * 添加神煞
     *
     * @param strs        常用神煞常量
     * @param shenShaName 神煞名称
     */
    protected void addShenSha1(String[] strs, String shenShaName) {

        // 判断日支，若匹配则添加日柱神煞
        for (String key : strs) {
            if (getDayGanZhi().equals(key)) this.dayGanZhiShenSha.add(shenShaName);
        }

    }

    /**
     * 添加神煞
     *
     * @param map    常用神煞常量
     * @param ganZhi 天干\地支
     */
    protected void addShenSha2(Map<String, String> map, String ganZhi) {

        // 1、计算四柱神煞
        this.yearGanZhiShenSha.add(map.get(ganZhi + getYearGan()));
        this.monthGanZhiShenSha.add(map.get(ganZhi + getMonthGan()));
        this.dayGanZhiShenSha.add(map.get(ganZhi + getDayGan()));
        this.hourGanZhiShenSha.add(map.get(ganZhi + getHourGan()));

        // 2、计算大运神煞、流年神煞、流月神煞、流日神煞、流时神煞
        this.daYunShenSha.add(map.get(ganZhi + getDaYunGan()));
        this.liuNianShenSha.add(map.get(ganZhi + getLiuNianGan()));
        this.liuYueShenSha.add(map.get(ganZhi + getLiuYueGan()));
        this.liuRiShenSha.add(map.get(ganZhi + getLiuRiGan()));
        this.liuShiShenSha.add(map.get(ganZhi + getLiuShiGan()));

    }

    /**
     * 添加神煞
     *
     * @param map    常用神煞常量
     * @param ganZhi 天干\地支
     */
    protected void addShenSha3(Map<String, String> map, String ganZhi) {

        // 1、计算四柱神煞
        this.yearGanZhiShenSha.add(map.get(ganZhi + getYearGanZhi()));
        this.monthGanZhiShenSha.add(map.get(ganZhi + getMonthGanZhi()));
        this.dayGanZhiShenSha.add(map.get(ganZhi + getDayGanZhi()));
        this.hourGanZhiShenSha.add(map.get(ganZhi + getHourGanZhi()));

        // 2、计算大运神煞、流年神煞、流月神煞、流日神煞、流时神煞
        this.daYunShenSha.add(map.get(ganZhi + getDaYunGanZhi()));
        this.liuNianShenSha.add(map.get(ganZhi + getLiuNianGanZhi()));
        this.liuYueShenSha.add(map.get(ganZhi + getLiuYueGanZhi()));
        this.liuRiShenSha.add(map.get(ganZhi + getLiuRiGanZhi()));
        this.liuShiShenSha.add(map.get(ganZhi + getLiuShiGanZhi()));

    }

    /**
     * 添加神煞
     *
     * @param map     常用神煞常量
     * @param ganZhi1 天干\地支
     * @param ganZhi2 天干\地支
     */
    protected void addShenSha4(Map<String, String> map, String ganZhi1, String ganZhi2) {

        // 1、计算四柱神煞
        this.yearGanZhiShenSha.add(map.get(ganZhi1 + getYearZhi()));
        this.monthGanZhiShenSha.add(map.get(ganZhi1 + getMonthZhi()));
        this.dayGanZhiShenSha.add(map.get(ganZhi1 + getDayZhi()));
        this.hourGanZhiShenSha.add(map.get(ganZhi1 + getHourZhi()));
        this.yearGanZhiShenSha.add(map.get(ganZhi2 + getYearZhi()));
        this.monthGanZhiShenSha.add(map.get(ganZhi2 + getMonthZhi()));
        this.dayGanZhiShenSha.add(map.get(ganZhi2 + getDayZhi()));
        this.hourGanZhiShenSha.add(map.get(ganZhi2 + getHourZhi()));

        // 2、计算大运神煞、流年神煞、流月神煞、流日神煞、流时神煞
        this.daYunShenSha.add(map.get(ganZhi1 + getDaYunZhi()));
        this.daYunShenSha.add(map.get(ganZhi2 + getDaYunZhi()));
        this.liuNianShenSha.add(map.get(ganZhi1 + getLiuNianZhi()));
        this.liuNianShenSha.add(map.get(ganZhi2 + getLiuNianZhi()));
        this.liuYueShenSha.add(map.get(ganZhi1 + getLiuYueZhi()));
        this.liuYueShenSha.add(map.get(ganZhi2 + getLiuYueZhi()));
        this.liuRiShenSha.add(map.get(ganZhi1 + getLiuRiZhi()));
        this.liuRiShenSha.add(map.get(ganZhi2 + getLiuRiZhi()));
        this.liuShiShenSha.add(map.get(ganZhi1 + getLiuShiZhi()));
        this.liuShiShenSha.add(map.get(ganZhi2 + getLiuShiZhi()));

    }


}
